/**
 * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package com.crossriver.crgis.database.service.persistence;

import com.crossriver.crgis.database.model.Documents;

import com.liferay.portal.kernel.bean.PortletBeanLocatorUtil;
import com.liferay.portal.kernel.dao.orm.DynamicQuery;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.util.OrderByComparator;
import com.liferay.portal.service.ServiceContext;

import java.util.List;

/**
 * The persistence utility for the documents service. This utility wraps {@link DocumentsPersistenceImpl} and provides direct access to the database for CRUD operations. This utility should only be used by the service layer, as it must operate within a transaction. Never access this utility in a JSP, controller, model, or other front-end class.
 *
 * <p>
 * Never modify this class directly. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
 * </p>
 *
 * <p>
 * Caching information and settings can be found in <code>portal.properties</code>
 * </p>
 *
 * @author Wole Adetiba
 * @see DocumentsPersistence
 * @see DocumentsPersistenceImpl
 * @generated
 */
public class DocumentsUtil {
	/**
	 * @see com.liferay.portal.service.persistence.BasePersistence#clearCache()
	 */
	public static void clearCache() {
		getPersistence().clearCache();
	}

	/**
	 * @see com.liferay.portal.service.persistence.BasePersistence#clearCache(com.liferay.portal.model.BaseModel)
	 */
	public static void clearCache(Documents documents) {
		getPersistence().clearCache(documents);
	}

	/**
	 * @see com.liferay.portal.service.persistence.BasePersistence#countWithDynamicQuery(DynamicQuery)
	 */
	public long countWithDynamicQuery(DynamicQuery dynamicQuery)
		throws SystemException {
		return getPersistence().countWithDynamicQuery(dynamicQuery);
	}

	/**
	 * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery)
	 */
	public static List<Documents> findWithDynamicQuery(
		DynamicQuery dynamicQuery) throws SystemException {
		return getPersistence().findWithDynamicQuery(dynamicQuery);
	}

	/**
	 * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery, int, int)
	 */
	public static List<Documents> findWithDynamicQuery(
		DynamicQuery dynamicQuery, int start, int end)
		throws SystemException {
		return getPersistence().findWithDynamicQuery(dynamicQuery, start, end);
	}

	/**
	 * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery, int, int, OrderByComparator)
	 */
	public static List<Documents> findWithDynamicQuery(
		DynamicQuery dynamicQuery, int start, int end,
		OrderByComparator orderByComparator) throws SystemException {
		return getPersistence()
				   .findWithDynamicQuery(dynamicQuery, start, end,
			orderByComparator);
	}

	/**
	 * @see com.liferay.portal.service.persistence.BasePersistence#remove(com.liferay.portal.model.BaseModel)
	 */
	public static Documents remove(Documents documents)
		throws SystemException {
		return getPersistence().remove(documents);
	}

	/**
	 * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel, boolean)
	 */
	public static Documents update(Documents documents, boolean merge)
		throws SystemException {
		return getPersistence().update(documents, merge);
	}

	/**
	 * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel, boolean, ServiceContext)
	 */
	public static Documents update(Documents documents, boolean merge,
		ServiceContext serviceContext) throws SystemException {
		return getPersistence().update(documents, merge, serviceContext);
	}

	/**
	* Caches the documents in the entity cache if it is enabled.
	*
	* @param documents the documents to cache
	*/
	public static void cacheResult(
		com.crossriver.crgis.database.model.Documents documents) {
		getPersistence().cacheResult(documents);
	}

	/**
	* Caches the documentses in the entity cache if it is enabled.
	*
	* @param documentses the documentses to cache
	*/
	public static void cacheResult(
		java.util.List<com.crossriver.crgis.database.model.Documents> documentses) {
		getPersistence().cacheResult(documentses);
	}

	/**
	* Creates a new documents with the primary key. Does not add the documents to the database.
	*
	* @param documentId the primary key for the new documents
	* @return the new documents
	*/
	public static com.crossriver.crgis.database.model.Documents create(
		java.lang.String documentId) {
		return getPersistence().create(documentId);
	}

	/**
	* Removes the documents with the primary key from the database. Also notifies the appropriate model listeners.
	*
	* @param documentId the primary key of the documents to remove
	* @return the documents that was removed
	* @throws com.crossriver.crgis.database.NoSuchDocumentsException if a documents with the primary key could not be found
	* @throws SystemException if a system exception occurred
	*/
	public static com.crossriver.crgis.database.model.Documents remove(
		java.lang.String documentId)
		throws com.crossriver.crgis.database.NoSuchDocumentsException,
			com.liferay.portal.kernel.exception.SystemException {
		return getPersistence().remove(documentId);
	}

	public static com.crossriver.crgis.database.model.Documents updateImpl(
		com.crossriver.crgis.database.model.Documents documents, boolean merge)
		throws com.liferay.portal.kernel.exception.SystemException {
		return getPersistence().updateImpl(documents, merge);
	}

	/**
	* Finds the documents with the primary key or throws a {@link com.crossriver.crgis.database.NoSuchDocumentsException} if it could not be found.
	*
	* @param documentId the primary key of the documents to find
	* @return the documents
	* @throws com.crossriver.crgis.database.NoSuchDocumentsException if a documents with the primary key could not be found
	* @throws SystemException if a system exception occurred
	*/
	public static com.crossriver.crgis.database.model.Documents findByPrimaryKey(
		java.lang.String documentId)
		throws com.crossriver.crgis.database.NoSuchDocumentsException,
			com.liferay.portal.kernel.exception.SystemException {
		return getPersistence().findByPrimaryKey(documentId);
	}

	/**
	* Finds the documents with the primary key or returns <code>null</code> if it could not be found.
	*
	* @param documentId the primary key of the documents to find
	* @return the documents, or <code>null</code> if a documents with the primary key could not be found
	* @throws SystemException if a system exception occurred
	*/
	public static com.crossriver.crgis.database.model.Documents fetchByPrimaryKey(
		java.lang.String documentId)
		throws com.liferay.portal.kernel.exception.SystemException {
		return getPersistence().fetchByPrimaryKey(documentId);
	}

	/**
	* Finds all the documentses where userId = &#63;.
	*
	* @param userId the user id to search with
	* @return the matching documentses
	* @throws SystemException if a system exception occurred
	*/
	public static java.util.List<com.crossriver.crgis.database.model.Documents> findByUserId(
		java.lang.String userId)
		throws com.liferay.portal.kernel.exception.SystemException {
		return getPersistence().findByUserId(userId);
	}

	/**
	* Finds a range of all the documentses where userId = &#63;.
	*
	* <p>
	* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	* </p>
	*
	* @param userId the user id to search with
	* @param start the lower bound of the range of documentses to return
	* @param end the upper bound of the range of documentses to return (not inclusive)
	* @return the range of matching documentses
	* @throws SystemException if a system exception occurred
	*/
	public static java.util.List<com.crossriver.crgis.database.model.Documents> findByUserId(
		java.lang.String userId, int start, int end)
		throws com.liferay.portal.kernel.exception.SystemException {
		return getPersistence().findByUserId(userId, start, end);
	}

	/**
	* Finds an ordered range of all the documentses where userId = &#63;.
	*
	* <p>
	* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	* </p>
	*
	* @param userId the user id to search with
	* @param start the lower bound of the range of documentses to return
	* @param end the upper bound of the range of documentses to return (not inclusive)
	* @param orderByComparator the comparator to order the results by
	* @return the ordered range of matching documentses
	* @throws SystemException if a system exception occurred
	*/
	public static java.util.List<com.crossriver.crgis.database.model.Documents> findByUserId(
		java.lang.String userId, int start, int end,
		com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
		throws com.liferay.portal.kernel.exception.SystemException {
		return getPersistence()
				   .findByUserId(userId, start, end, orderByComparator);
	}

	/**
	* Finds the first documents in the ordered set where userId = &#63;.
	*
	* <p>
	* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	* </p>
	*
	* @param userId the user id to search with
	* @param orderByComparator the comparator to order the set by
	* @return the first matching documents
	* @throws com.crossriver.crgis.database.NoSuchDocumentsException if a matching documents could not be found
	* @throws SystemException if a system exception occurred
	*/
	public static com.crossriver.crgis.database.model.Documents findByUserId_First(
		java.lang.String userId,
		com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
		throws com.crossriver.crgis.database.NoSuchDocumentsException,
			com.liferay.portal.kernel.exception.SystemException {
		return getPersistence().findByUserId_First(userId, orderByComparator);
	}

	/**
	* Finds the last documents in the ordered set where userId = &#63;.
	*
	* <p>
	* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	* </p>
	*
	* @param userId the user id to search with
	* @param orderByComparator the comparator to order the set by
	* @return the last matching documents
	* @throws com.crossriver.crgis.database.NoSuchDocumentsException if a matching documents could not be found
	* @throws SystemException if a system exception occurred
	*/
	public static com.crossriver.crgis.database.model.Documents findByUserId_Last(
		java.lang.String userId,
		com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
		throws com.crossriver.crgis.database.NoSuchDocumentsException,
			com.liferay.portal.kernel.exception.SystemException {
		return getPersistence().findByUserId_Last(userId, orderByComparator);
	}

	/**
	* Finds the documentses before and after the current documents in the ordered set where userId = &#63;.
	*
	* <p>
	* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	* </p>
	*
	* @param documentId the primary key of the current documents
	* @param userId the user id to search with
	* @param orderByComparator the comparator to order the set by
	* @return the previous, current, and next documents
	* @throws com.crossriver.crgis.database.NoSuchDocumentsException if a documents with the primary key could not be found
	* @throws SystemException if a system exception occurred
	*/
	public static com.crossriver.crgis.database.model.Documents[] findByUserId_PrevAndNext(
		java.lang.String documentId, java.lang.String userId,
		com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
		throws com.crossriver.crgis.database.NoSuchDocumentsException,
			com.liferay.portal.kernel.exception.SystemException {
		return getPersistence()
				   .findByUserId_PrevAndNext(documentId, userId,
			orderByComparator);
	}

	/**
	* Finds all the documentses where applicationId = &#63;.
	*
	* @param applicationId the application id to search with
	* @return the matching documentses
	* @throws SystemException if a system exception occurred
	*/
	public static java.util.List<com.crossriver.crgis.database.model.Documents> findByApplicationId(
		java.lang.String applicationId)
		throws com.liferay.portal.kernel.exception.SystemException {
		return getPersistence().findByApplicationId(applicationId);
	}

	/**
	* Finds a range of all the documentses where applicationId = &#63;.
	*
	* <p>
	* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	* </p>
	*
	* @param applicationId the application id to search with
	* @param start the lower bound of the range of documentses to return
	* @param end the upper bound of the range of documentses to return (not inclusive)
	* @return the range of matching documentses
	* @throws SystemException if a system exception occurred
	*/
	public static java.util.List<com.crossriver.crgis.database.model.Documents> findByApplicationId(
		java.lang.String applicationId, int start, int end)
		throws com.liferay.portal.kernel.exception.SystemException {
		return getPersistence().findByApplicationId(applicationId, start, end);
	}

	/**
	* Finds an ordered range of all the documentses where applicationId = &#63;.
	*
	* <p>
	* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	* </p>
	*
	* @param applicationId the application id to search with
	* @param start the lower bound of the range of documentses to return
	* @param end the upper bound of the range of documentses to return (not inclusive)
	* @param orderByComparator the comparator to order the results by
	* @return the ordered range of matching documentses
	* @throws SystemException if a system exception occurred
	*/
	public static java.util.List<com.crossriver.crgis.database.model.Documents> findByApplicationId(
		java.lang.String applicationId, int start, int end,
		com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
		throws com.liferay.portal.kernel.exception.SystemException {
		return getPersistence()
				   .findByApplicationId(applicationId, start, end,
			orderByComparator);
	}

	/**
	* Finds the first documents in the ordered set where applicationId = &#63;.
	*
	* <p>
	* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	* </p>
	*
	* @param applicationId the application id to search with
	* @param orderByComparator the comparator to order the set by
	* @return the first matching documents
	* @throws com.crossriver.crgis.database.NoSuchDocumentsException if a matching documents could not be found
	* @throws SystemException if a system exception occurred
	*/
	public static com.crossriver.crgis.database.model.Documents findByApplicationId_First(
		java.lang.String applicationId,
		com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
		throws com.crossriver.crgis.database.NoSuchDocumentsException,
			com.liferay.portal.kernel.exception.SystemException {
		return getPersistence()
				   .findByApplicationId_First(applicationId, orderByComparator);
	}

	/**
	* Finds the last documents in the ordered set where applicationId = &#63;.
	*
	* <p>
	* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	* </p>
	*
	* @param applicationId the application id to search with
	* @param orderByComparator the comparator to order the set by
	* @return the last matching documents
	* @throws com.crossriver.crgis.database.NoSuchDocumentsException if a matching documents could not be found
	* @throws SystemException if a system exception occurred
	*/
	public static com.crossriver.crgis.database.model.Documents findByApplicationId_Last(
		java.lang.String applicationId,
		com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
		throws com.crossriver.crgis.database.NoSuchDocumentsException,
			com.liferay.portal.kernel.exception.SystemException {
		return getPersistence()
				   .findByApplicationId_Last(applicationId, orderByComparator);
	}

	/**
	* Finds the documentses before and after the current documents in the ordered set where applicationId = &#63;.
	*
	* <p>
	* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	* </p>
	*
	* @param documentId the primary key of the current documents
	* @param applicationId the application id to search with
	* @param orderByComparator the comparator to order the set by
	* @return the previous, current, and next documents
	* @throws com.crossriver.crgis.database.NoSuchDocumentsException if a documents with the primary key could not be found
	* @throws SystemException if a system exception occurred
	*/
	public static com.crossriver.crgis.database.model.Documents[] findByApplicationId_PrevAndNext(
		java.lang.String documentId, java.lang.String applicationId,
		com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
		throws com.crossriver.crgis.database.NoSuchDocumentsException,
			com.liferay.portal.kernel.exception.SystemException {
		return getPersistence()
				   .findByApplicationId_PrevAndNext(documentId, applicationId,
			orderByComparator);
	}

	/**
	* Finds all the documentses.
	*
	* @return the documentses
	* @throws SystemException if a system exception occurred
	*/
	public static java.util.List<com.crossriver.crgis.database.model.Documents> findAll()
		throws com.liferay.portal.kernel.exception.SystemException {
		return getPersistence().findAll();
	}

	/**
	* Finds a range of all the documentses.
	*
	* <p>
	* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	* </p>
	*
	* @param start the lower bound of the range of documentses to return
	* @param end the upper bound of the range of documentses to return (not inclusive)
	* @return the range of documentses
	* @throws SystemException if a system exception occurred
	*/
	public static java.util.List<com.crossriver.crgis.database.model.Documents> findAll(
		int start, int end)
		throws com.liferay.portal.kernel.exception.SystemException {
		return getPersistence().findAll(start, end);
	}

	/**
	* Finds an ordered range of all the documentses.
	*
	* <p>
	* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	* </p>
	*
	* @param start the lower bound of the range of documentses to return
	* @param end the upper bound of the range of documentses to return (not inclusive)
	* @param orderByComparator the comparator to order the results by
	* @return the ordered range of documentses
	* @throws SystemException if a system exception occurred
	*/
	public static java.util.List<com.crossriver.crgis.database.model.Documents> findAll(
		int start, int end,
		com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
		throws com.liferay.portal.kernel.exception.SystemException {
		return getPersistence().findAll(start, end, orderByComparator);
	}

	/**
	* Removes all the documentses where userId = &#63; from the database.
	*
	* @param userId the user id to search with
	* @throws SystemException if a system exception occurred
	*/
	public static void removeByUserId(java.lang.String userId)
		throws com.liferay.portal.kernel.exception.SystemException {
		getPersistence().removeByUserId(userId);
	}

	/**
	* Removes all the documentses where applicationId = &#63; from the database.
	*
	* @param applicationId the application id to search with
	* @throws SystemException if a system exception occurred
	*/
	public static void removeByApplicationId(java.lang.String applicationId)
		throws com.liferay.portal.kernel.exception.SystemException {
		getPersistence().removeByApplicationId(applicationId);
	}

	/**
	* Removes all the documentses from the database.
	*
	* @throws SystemException if a system exception occurred
	*/
	public static void removeAll()
		throws com.liferay.portal.kernel.exception.SystemException {
		getPersistence().removeAll();
	}

	/**
	* Counts all the documentses where userId = &#63;.
	*
	* @param userId the user id to search with
	* @return the number of matching documentses
	* @throws SystemException if a system exception occurred
	*/
	public static int countByUserId(java.lang.String userId)
		throws com.liferay.portal.kernel.exception.SystemException {
		return getPersistence().countByUserId(userId);
	}

	/**
	* Counts all the documentses where applicationId = &#63;.
	*
	* @param applicationId the application id to search with
	* @return the number of matching documentses
	* @throws SystemException if a system exception occurred
	*/
	public static int countByApplicationId(java.lang.String applicationId)
		throws com.liferay.portal.kernel.exception.SystemException {
		return getPersistence().countByApplicationId(applicationId);
	}

	/**
	* Counts all the documentses.
	*
	* @return the number of documentses
	* @throws SystemException if a system exception occurred
	*/
	public static int countAll()
		throws com.liferay.portal.kernel.exception.SystemException {
		return getPersistence().countAll();
	}

	public static DocumentsPersistence getPersistence() {
		if (_persistence == null) {
			_persistence = (DocumentsPersistence)PortletBeanLocatorUtil.locate(com.crossriver.crgis.database.service.ClpSerializer.SERVLET_CONTEXT_NAME,
					DocumentsPersistence.class.getName());
		}

		return _persistence;
	}

	public void setPersistence(DocumentsPersistence persistence) {
		_persistence = persistence;
	}

	private static DocumentsPersistence _persistence;
}